package com.weirong.smartvault.backservice.controller.fragment_entity;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * 于2017/11/26由 KFEB4 创建 .
 */
public class Header {
    List<Menu> menuList;
    List<Menu> nowPath;
    public Header(String nowPath){
        menuList = Menu.BuildMenu(nowPath);
        List<Menu> temp = menuList;
        this.nowPath = new ArrayList<>();
        for(String region :nowPath.split("/")){
            if(temp==null)
                break;
            for(Menu t:temp){
                if (Objects.equals(t.getUrlEnd(), region)){
                    temp = t.getSubMenus();
                    this.nowPath.add(t);
                    break;
                }
            }
        }
    }
    public List<Menu> getMenuList() {
        return menuList;
    }

    public List<Menu> getNowPath() {
        return nowPath;
    }
}

